import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import design from './modules/design'
import getters from './getters'
import createPersistedState from 'vuex-persistedstate'

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    user,
    design
  },
  getters,
  plugins:[createPersistedState({
    //存储到sessionStorage
    key:'middleMainApplication',
    storage: window.localStorage,
    reducer(val){
      //配置需要存储哪些值
      return {
        user: {
          userInfo: val.user.userInfo
        }
      }
    } 
  })]
})

export default store
